public class Solution {
    public int[] constructRectangle(int area) {
        int w = (int) Math.sqrt(area);
        while (area % w != 0) {
            --w;
        }
        return new int[]{area / w, w};
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int area = 37;
        int[] result = solution.constructRectangle(area);
        System.out.println("[" + result[0] + ", " + result[1] + "]");
    }
}
